define(function(require, exports, module) { 
	"require:nomunge,exports:nomunge,module:nomunge";
    var self = exports;
    var utils = require('mokit/utils');
    var service = require('./service');
    var user = require("./User");
	
	var dt = new Date();
	self.list = [];
	self.args = {
		userId: user.state.userId,
		year: dt.getFullYear(),
		month: dt.getMonth() + 1,
		date: dt.getDate()	
	};
	self.item = {
		id: user.state.userId,
		scheduleTitle:"",
		scheduleContent:"",
		projectId: 0,
		scheduleTime: ""
	};
	//获取日程列表
	self.getList = function(callback){
        service.ucenter.schedule.getList(this.args, function(rs, err) {
            if (err && callback) return callback(err.message || err);
            if (rs.success) {
               	self.list = rs.obj;
                if (callback) callback();
            } else {
                rs = rs || {};
                var msg = rs.msg || 'unknow error';
                if (callback) callback(msg);
            }
        });
	};
	//添加日程
	self.addItem = function(callback){
        service.ucenter.schedule.add(this.item, function(rs, err) {
            if (err && callback) return callback(err.message || err);
            if (rs.success) {
               	//self.list = rs.obj;
                if (callback) callback();
            } else {
                rs = rs || {};
                var msg = rs.msg || 'unknow error';
                if (callback) callback(msg);
            }
        });
	};	
	
	
});